package com.dlc.shop.systemtest.api.common;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dlc.shop.bean.model.HotSearch;
import com.dlc.shop.bean.model.Notice;
import com.dlc.shop.common.util.Json;
import com.dlc.shop.systemtest.constants.Constant;
import com.dlc.shop.systemtest.util.HttpUtil;

import java.util.List;

/**
 * @author chendan
 */
public class PlatformNoticeApi {
    /**
     * 新增公告
     * */
    public static void save(Notice notice){
        String url = Constant.PLATFORM_URL+"/platform/notice";
        HttpUtil.post(url,notice);
    }
    /**
     * 搜索公告
     * */
    public static List<Notice> listNotice (){
        String url = Constant.PLATFORM_URL+"/platform/notice";
        return JSON.parseArray(JSON.toJSONString(HttpUtil.get(url, List.class)),Notice.class);
    }
    /**
     * 删除公告
     * */
    public static void delete(String urlAfter,Long id){
        String url = Constant.PLATFORM_URL+"/platform/notice/"+id;
        HttpUtil.delete(url);
    }
    /**
     * 编辑公告
     * */
    public static void update(String urlAfter, Notice notice){
        String url = Constant.PLATFORM_URL + "/platform/notice";
        HttpUtil.put(url,notice);
    }
}